import Setting from '@/setting.env'

/**
 * 商品评论的radio类型
 * @type {({val: string, label: string}|{val: string, label: string}|{val: string, label: string}|{val: string, label: string})[]}
 */
export const replyRadioType = [
  { label: '全部', val: -99 },
  { label: '好评', val: 1 },
  { label: '中评', val: 2 },
  { label: '差评', val: 3 }
];

/**
 * 无限极分类Type
 * @type {[*]}
 */
export const cateGoryType = [
  { name: '产品分类', value: 1, shortName: '产品' }
]

/**
 * 下拉分类数据
 * @type {[*]}
 */
export const roleListStatus = [
  { label: '全部', value: -1 },
  { label: '显示', value: 1 },
  { label: '不显示', value: 0 }
];

/**
 * 退款状态
 * @type {({label: string, key: number}|{label: string, key: number}|{label: string, key: number}|{label: string, key: number}|{label: string, key: number})[]}
 */
export const orderStateGroup = [
  { key: -99, label: `全部` },
  { key: 1, label: `申请中` },
  { key: 2, label: `拒绝退款` },
  { key: 3, label: `商品待退货` },
  { key: 4, label: `退货待收货` },
  { key: 5, label: `已退款` }
];

/**
 * 退款类型
 * @type {({label: string, key: number}|{label: string, key: number}|{label: string, key: number})[]}
 */
export const orderTypeGroup = [
  { key: -99, label: `全部` },
  { key: 1, label: `仅退款` },
  { key: 2, label: `退货退款` }
];

/**
 * tab
 */
export function tabsListHead(list = []) {
  return list.map((item, index) => {
    return { label: item, type: index - 1, count: 0 }
  })
}

/**
 * 订单列表
 * @type {({count: number, label: string, value: number}|{count: number, label: string, value: number}|{count: number, label: string, value: number}|{count: number, label: string, value: number}|{count: number, label: string, value: number})[]}
 */
export const tabOrder = [
  { label: '全部订单', value: -1, count: 0 },
  { label: '普通订单', value: 0, count: 0 },
  { label: '拼团订单', value: 1, count: 0 },
  { label: '秒杀订单', value: 2, count: 0 },
  { label: '砍价订单', value: 3, count: 0 }
];

/**
 * 时间选择器
 * @type {{fromTxt: ({val: string, text: string}|{val: string, text: string}|{val: string, text: string}|{val: string, text: string}|{val: string, text: string})[], custom: boolean, title: string}}
 */
export const fromList = {
  title: '选择时间',
  custom: true,
  fromTxt: [
    { text: '全部', val: '' },
    { text: '今天', val: 'today' },
    { text: '昨天', val: 'yesterday' },
    { text: '最近7天', val: 'lately7' },
    { text: '最近30天', val: 'lately30' },
    { text: '本月', val: 'month' },
    { text: '本年', val: 'year' }
  ]
}

export function env() { return Setting.uploadURL }
